#include "Player.h"

#include "RegUtils.h"

Player::Player(void)
{
}

Player::Player( string _username )
	:mUsername( _username), mTotalGamesPlayed(0), mBestScore(0), mCurrentGamePoints(0), mAllTimePoints(0)
{

}


Player::~Player(void)
{
}

UINT Player::CurrentGamePoints() const
{
	return mCurrentGamePoints;
}

void Player::CurrentGamePoints( UINT val )
{
	mCurrentGamePoints = val;
}


const string& Player::Username() const
{
	return mUsername;
}

void Player::Username( string val )
{
	mUsername = val;
}

unsigned long Player::AllTimePoints() const
{
	return mAllTimePoints;
}

void Player::AllTimePoints( unsigned long val )
{
	mAllTimePoints = val;
}

UINT Player::BestScore() const
{
	return mBestScore;
}

void Player::BestScore( UINT val )
{
	mBestScore = val;
}

UINT Player::TotalGamesPlayed() const
{
	return mTotalGamesPlayed;
}

void Player::TotalGamesPlayed( UINT val )
{
	mTotalGamesPlayed = val;
}

bool Player::IsAdmin() const
{
	return mIsAdmin;
}

void Player::IsAdmin( bool val )
{
	mIsAdmin = val;
}

std::string Player::Password() const
{
	return mPassword;
}

void Player::Password( string val )
{
	mPassword = val;
}

void Player::AddPoints( UINT _points )
{
	
	mAllTimePoints += _points;
	mCurrentGamePoints += _points;
	
	if( mCurrentGamePoints > mBestScore)
		mBestScore = mCurrentGamePoints;

	RegUtils::SavePlayerInfo(*this);
}

void Player::IncPlayedGames()
{
	mTotalGamesPlayed++;
	RegUtils::SavePlayerInfo(*this);
}
